class TypeofClass extends Function {
  constructor() {
    let Reg = /^\[object\s(.*?)\]$/,
      typeList = [
        'Array',
        'Object',
        'Function',
        'Undefined',
        'Null',
        'Symbol',
        'Date',
        'String',
        'Number',
        'Boolean',
        'Map',
        'Set',
        'WeakMap',
        'WeakSet'
      ]
    super(
      `value`,
      `return Object.prototype.toString.call(value)
      .replace(${Reg}, '$1')`
    )
    for (const type of typeList) {
      this[`is${type}`] = value =>
        Object.prototype.toString.call(value) === `[object ${type}]`
    }
  }
}
//
export const Typeof = new TypeofClass()
